using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using QLPMT_DTO;

namespace QLPMT_DAO
{
   public class BaoCaoDoanhThuDAO
    {
       DataProvider provider;
       public BaoCaoDoanhThuDAO()
       {
           provider = new DataProvider();
       }
       // Lay Ma Bao Cao
       public List<BaoCaoDoanhThu> GetALL()
       {
              provider.Connect();
           string sql = "select * from BaoCaoDoanhThuTheoThang";
           SqlDataReader reader = provider.ExecuteReader(sql);
           List<BaoCaoDoanhThu> list = new List<BaoCaoDoanhThu>();
           while (reader.Read())
           {
               string ma = reader.GetString(0);
               double doanhthu = reader.GetDouble(1);
               int benhnhan = reader.GetInt32(2);
               BaoCaoDoanhThu dto = new BaoCaoDoanhThu(ma,doanhthu,benhnhan);
               list.Add(dto);
           }
           provider.Disconnect();
           return list;
       }
    }
}
